
public class Procedure extends Atom {
	private boolean isPrimitive;
	
	private Data parameters;
	private Data sequence;
	private Environment environment;
	
	public Procedure(Object data) {
		super(data);
		isPrimitive = true;
		environment = Evaluator.THE_GLOBAL_ENVIRONMENT;
	}
	
	public Procedure(Data _parameters, Data _sequence, Environment _env) {
		super(_sequence);
		setParameters(_parameters);
		setBodySequence(_sequence);
		setEnvironment(_env);
		isPrimitive = false;
	}
	
	public boolean isPrimitiveProcedure() {
		return isPrimitive;
	}

	public boolean isCompoundProcedure() {
		return !isPrimitive;
	}
	
	public boolean isProcedure() {
		return true;
	}
	
	public void setParameters(Data parameters) {
		this.parameters = parameters;
	}

	public Data getLetParameters() {
		return parameters;
	}

	public void setBodySequence(Data body) {
		this.sequence = body;
	}

	public Data getBodySequence() {
		return sequence;
	}

	public void setEnvironment(Environment env) {
		this.environment = env;
	}

	public Environment getEnvironment() {
		return environment;
	}
	
	public String toString() {
		return "#[closure arglist=" 
		+ this.getLetParameters() + " " + hashCode() + "]";
	}

}
